#include <iostream>
#include <string>
#include <unordered_map>
#include <set>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;

	unordered_multimap<string, set<string>> dict;
	for (int i = 0; i < n; ++i)
	{
		string tmp;
		cin >> tmp;

		unordered_multimap<string, set<string>>::iterator it = dict.find(tmp);
		if (it != dict.end())
		{
			it->second.insert(tmp);
		}
		else
		{
			set<string> ss;
			ss.insert(tmp);
			dict.insert(make_pair(tmp, ss));
		}
	}

	for (int i = 0; i < m; ++i)
	{
		string q;
		cin >> q;

		bool found = false;
		if (dict.size() > 1000)
		{
			for (int j = 0; j < q.length(); ++j)
			{
				for (int k = 0; k < 3; ++k)
				{
					if (q[j] != 'a' + k)
					{
						string s = q;
						s[j] = 'a' + k;

						unordered_multimap<string, set<string>>::iterator itor = dict.find(s);
						if (itor != dict.end())
						{
							set<string>::iterator it = itor->second.begin();
							while (it != itor->second.end())
							{
								if (*it == s)
								{
									found = true;
									break;
								}
							}
						}
					}
					if (found) break;
				}
				if (found) break;
			}
		}
		else
		{
			// bruteforce search
			unordered_multimap<string, set<string>>::iterator itor = dict.begin();
			while (itor != dict.end())
			{
				set<string>::iterator it = itor->second.begin();
				while (it != itor->second.end() && it->length() == q.length())
				{
					int j = 0;
					int cnt = 0;
					for (; j < q.length(); ++j)
					{
						if (q[j] != (*it)[j]) ++cnt;

						if (cnt > 1) break;
					}

					if (j == q.length() && cnt == 1)
					{
						found = true;
						break;
					}
					++it;
				}

				if (found) break;
				++itor;
			}
		}
		
		if (found)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}